<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>03 点菜小程序</title>
</head>
<body>
    <h1>03 点菜小程序</h1>
    <input type="text" name="" id="tex">
    <input type="button" value="点菜" id="btn">
</body>
<script src="../common.js"></script>
<script>
    (function() {

        var btn = getid('btn');
        var tex = getid('tex');

        // 点菜小程序
        var arr = ['红烧肉', '啤酒闷鸭', '铁锅炖大鹅', '寿司', '麻辣烫', '火锅', '汉堡包', '牛排'];

        btn.onclick = function() {
            var num = parseInt(Math.random() * arr.length);
            tex.value = arr[num];
        }


    })();
</script>
</html>